<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WiFi Logger component: include/tcp_handler.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">WiFi Logger component
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">WiFi Logger component, uses wifi to output logs</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">tcp_handler.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="tcp__handler_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef TCP_HANDLER_H</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define TCP_HANDLER_H</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;sys/param.h&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;freertos/FreeRTOS.h&quot;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;freertos/task.h&quot;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;freertos/event_groups.h&quot;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;esp_system.h&quot;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;esp_wifi.h&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;esp_event.h&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;esp_log.h&quot;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;nvs_flash.h&quot;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;esp_netif.h&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;protocol_examples_common.h&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;lwip/err.h&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;lwip/sockets.h&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;lwip/sys.h&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;lwip/netdb.h&gt;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="tcp__handler_8h.html#a30e0c38ad4a5d0a16bfdd52ff64189b4">   21</a></span>&#160;<span class="preprocessor">#define TCP_HOST_IP_ADDR CONFIG_SERVER_IP_ADDRESS</span></div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="tcp__handler_8h.html#a637b73f06ee87043251d022f87a8f3d4">   22</a></span>&#160;<span class="preprocessor">#define TCP_PORT CONFIG_SERVER_PORT</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structtcp__network__data.html">   24</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structtcp__network__data.html">tcp_network_data</a></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;{</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#aec4bca454d64124cd3a4b001f4a551cc">   26</a></span>&#160;    <span class="keywordtype">char</span> <a class="code" href="structtcp__network__data.html#aec4bca454d64124cd3a4b001f4a551cc">rx_buffer</a>[128];</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#a5bb07a33391c99faa2caab2ef4477944">   27</a></span>&#160;    <span class="keywordtype">char</span> <a class="code" href="structtcp__network__data.html#a5bb07a33391c99faa2caab2ef4477944">addr_str</a>[128];</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#a901043d5d480118c9e8661464465ae95">   28</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structtcp__network__data.html#a901043d5d480118c9e8661464465ae95">addr_family</a>;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#ac9025540ea4138efba1544b3fbbb2db3">   29</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structtcp__network__data.html#ac9025540ea4138efba1544b3fbbb2db3">ip_protocol</a>;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#aac1fae2cd9f342a287fc728c2171e3d1">   30</a></span>&#160;    <span class="keyword">struct </span>sockaddr_in <a class="code" href="structtcp__network__data.html#aac1fae2cd9f342a287fc728c2171e3d1">dest_addr</a>;</div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structtcp__network__data.html#a78063825cce60cb5f121e2c87ccb6dbb">   31</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structtcp__network__data.html#a78063825cce60cb5f121e2c87ccb6dbb">sock</a>;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;};</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keywordtype">void</span> <a class="code" href="tcp__handler_8h.html#a6be7633691ba5c012155871a84ade82e">tcp_network_manager</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__network__data.html">tcp_network_data</a>* nm);</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keywordtype">int</span> <a class="code" href="tcp__handler_8h.html#a0ca62b309e39660b29ee7605b099ee54">tcp_send_data</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__network__data.html">tcp_network_data</a>* nm, <span class="keywordtype">char</span>* payload);</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="keywordtype">char</span>* <a class="code" href="tcp__handler_8h.html#ae6ccc1779864871030d25e2b8c7d56f4">tcp_receive_data</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__network__data.html">tcp_network_data</a>* nm);</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keywordtype">void</span> <a class="code" href="tcp__handler_8h.html#a6d6a248c21ebfece9f52fa7b580fabb5">tcp_close_network_manager</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__network__data.html">tcp_network_data</a>* nm);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="tcp__handler_8h_html_ae6ccc1779864871030d25e2b8c7d56f4"><div class="ttname"><a href="tcp__handler_8h.html#ae6ccc1779864871030d25e2b8c7d56f4">tcp_receive_data</a></div><div class="ttdeci">char * tcp_receive_data(struct tcp_network_data *nm)</div><div class="ttdoc">Receives data from TCP server. </div><div class="ttdef"><b>Definition:</b> tcp_handler.c:77</div></div>
<div class="ttc" id="structtcp__network__data_html_a78063825cce60cb5f121e2c87ccb6dbb"><div class="ttname"><a href="structtcp__network__data.html#a78063825cce60cb5f121e2c87ccb6dbb">tcp_network_data::sock</a></div><div class="ttdeci">int sock</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:31</div></div>
<div class="ttc" id="structtcp__network__data_html_a5bb07a33391c99faa2caab2ef4477944"><div class="ttname"><a href="structtcp__network__data.html#a5bb07a33391c99faa2caab2ef4477944">tcp_network_data::addr_str</a></div><div class="ttdeci">char addr_str[128]</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:27</div></div>
<div class="ttc" id="structtcp__network__data_html_aec4bca454d64124cd3a4b001f4a551cc"><div class="ttname"><a href="structtcp__network__data.html#aec4bca454d64124cd3a4b001f4a551cc">tcp_network_data::rx_buffer</a></div><div class="ttdeci">char rx_buffer[128]</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:26</div></div>
<div class="ttc" id="tcp__handler_8h_html_a6be7633691ba5c012155871a84ade82e"><div class="ttname"><a href="tcp__handler_8h.html#a6be7633691ba5c012155871a84ade82e">tcp_network_manager</a></div><div class="ttdeci">void tcp_network_manager(struct tcp_network_data *nm)</div><div class="ttdoc">Manages TCP connection to the server. </div><div class="ttdef"><b>Definition:</b> tcp_handler.c:11</div></div>
<div class="ttc" id="tcp__handler_8h_html_a6d6a248c21ebfece9f52fa7b580fabb5"><div class="ttname"><a href="tcp__handler_8h.html#a6d6a248c21ebfece9f52fa7b580fabb5">tcp_close_network_manager</a></div><div class="ttdeci">void tcp_close_network_manager(struct tcp_network_data *nm)</div><div class="ttdoc">Shutdown active connection, deallocate memory. </div><div class="ttdef"><b>Definition:</b> tcp_handler.c:109</div></div>
<div class="ttc" id="structtcp__network__data_html_a901043d5d480118c9e8661464465ae95"><div class="ttname"><a href="structtcp__network__data.html#a901043d5d480118c9e8661464465ae95">tcp_network_data::addr_family</a></div><div class="ttdeci">int addr_family</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:28</div></div>
<div class="ttc" id="structtcp__network__data_html_ac9025540ea4138efba1544b3fbbb2db3"><div class="ttname"><a href="structtcp__network__data.html#ac9025540ea4138efba1544b3fbbb2db3">tcp_network_data::ip_protocol</a></div><div class="ttdeci">int ip_protocol</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:29</div></div>
<div class="ttc" id="structtcp__network__data_html_aac1fae2cd9f342a287fc728c2171e3d1"><div class="ttname"><a href="structtcp__network__data.html#aac1fae2cd9f342a287fc728c2171e3d1">tcp_network_data::dest_addr</a></div><div class="ttdeci">struct sockaddr_in dest_addr</div><div class="ttdef"><b>Definition:</b> tcp_handler.h:30</div></div>
<div class="ttc" id="tcp__handler_8h_html_a0ca62b309e39660b29ee7605b099ee54"><div class="ttname"><a href="tcp__handler_8h.html#a0ca62b309e39660b29ee7605b099ee54">tcp_send_data</a></div><div class="ttdeci">int tcp_send_data(struct tcp_network_data *nm, char *payload)</div><div class="ttdoc">Sends data to the server through a TCP socket. </div><div class="ttdef"><b>Definition:</b> tcp_handler.c:49</div></div>
<div class="ttc" id="structtcp__network__data_html"><div class="ttname"><a href="structtcp__network__data.html">tcp_network_data</a></div><div class="ttdef"><b>Definition:</b> tcp_handler.h:24</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
